home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
WarriorsProgress.sit
/
Warrior’s Progress
/
source code
/
Source
/
Libraries
/
Strings
/
ConstPString.h
< prev
next >
Wrap
Text File
|
1997-06-28
|
1KB
|
51 lines
// ConstPString.h
#ifndef ConstPString_h
#define ConstPString_h
#ifndef ConstData_h
#include "ConstData.h"
#endif
class ConstPString
{
private:
ConstStr255Param string;
operator=( const ConstPString& ); // This method intentionally left undefined.
public:
ConstPString( ConstStr255Param s )
: string( s )
{
Assert( s != 0 );
}
uint8 Length() const { return string[0]; }
URange32 Range() const { return URange32( 0, Length() ); }
const uint8& operator[]( uint32 i ) const
{ Assert( i < Length() ); return string[i+1]; }
ConstData Text() const { return ConstData( string+1, Length() ); }
ConstData Head( uint32 size ) const { return Text().Head( size ); }
ConstData Tail( uint32 position ) const { return Text().Tail( position ); }
ConstData Middle( URange32 range ) const { return Text().Middle( range ); }
operator ConstStr255Param() const { return string; }
operator ConstData() const { return Text(); }
};
bool operator==( ConstPString a, ConstPString b );
bool operator< ( ConstPString a, ConstPString b );
bool operator<=( ConstPString a, ConstPString b );
inline bool operator!=( ConstPString a, ConstPString b ) { return !(a == b); }
inline bool operator> ( ConstPString a, ConstPString b ) { return !(a <= b); }
inline bool operator>=( ConstPString a, ConstPString b ) { return !(a < b); }
int32 Compare( ConstPString a, ConstPString b );
#endif